#pragma once

#include <map>
#include <vector>



namespace Putin{
class Unit;
class Player;
class Map;
class StaticObject;

/*!
 * \brief  Keeps track of the game state
 * 
 * The game state, what units exist in game, where etc. is kept in this class
 */
class Gamestate
{
public:

	Gamestate(Map* map, int numPlayers);
	virtual ~Gamestate();

	bool add(Unit* unit);
	void add(Player* player);
	bool add(StaticObject* obj);
	void select(int id);
	void deselect(int id);
	void clearSelection();

	Unit* getUnit(int id);

	StaticObject* getObject(int id);

	void removeUnit(int id);
	void removeObject(int id);

	Map* getMap();

	int nextId();

protected:


	int mNextId;
	Map*						mMap;

public: // made public for ease of iteration etc.
	std::map<int,Unit*>			mUnits;
	std::map<int,StaticObject*> mObjects;
	std::vector<Player*>		mPlayers;
	std::map<int,bool>			mSelected;
	int							mNumPlayers;
};


}
